package com.lmx.repoDomain.repository;

import org.springframework.stereotype.Component;

import com.lmx.repoDomain.tmodel.CustomerServiceItem;//hubiati
import com.lmx.repoDomain.tmodel.NursingProject;//hubiati

import io.katharsis.queryParams.QueryParams;
import io.katharsis.repository.annotations.JsonApiAddRelations;
import io.katharsis.repository.annotations.JsonApiRelationshipRepository;
import io.katharsis.repository.annotations.JsonApiRemoveRelations;
import io.katharsis.repository.annotations.JsonApiSetRelation;
import io.katharsis.utils.PropertyUtils;

@JsonApiRelationshipRepository(source = NursingProject.class, target = CustomerServiceItem.class)
@Component
public class NursingProjectToServiceItemRepository extends BaseRelationRepository<NursingProject, CustomerServiceItem> {

//    private final NursingProjectRepository projectRepository;
//    private final  CustomerServiceItemRepository  itemRepository;
//	
//    public NursingProjectToServiceItemRepository(NursingProjectRepository projectRepository,
//			CustomerServiceItemRepository itemRepository) {
//		super();
//		this.projectRepository = projectRepository;
//		this.itemRepository = itemRepository;
//	}

	@Override
    @JsonApiSetRelation
    public void setRelation(final NursingProject project, final Long taskId, final String fieldName) {
//    	CustomerServiceItem item = itemRepository.findOne(taskId, null);
//        try {
//            PropertyUtils.setProperty(project, fieldName, item);
//        } catch (Exception e) {
//            throw new RuntimeException(e);
//        }
//        projectRepository.save(project);

    }

    @Override
    @JsonApiAddRelations
    public void addRelations(final NursingProject source, final Iterable<Long> targetIds, final String fieldName) {
    }

    @Override
    @JsonApiRemoveRelations
    public void removeRelations(final NursingProject source, final Iterable<Long> targetIds, final String fieldName) {
    }


    @Override
    public void setRelations(final NursingProject source, final Iterable<Long> targetIds, final String fieldName) {
        // TODO Auto-generated method stub

    }

    @Override
    public CustomerServiceItem findOneTarget(final Long sourceId, final String fieldName, final QueryParams queryParams) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Iterable<CustomerServiceItem> findManyTargets(final Long sourceId, final String fieldName, final QueryParams queryParams) {
        return null;
    }
}
